<template>
  <div class="enterprise-user">

    <ContentWrap>
      <el-table v-loading="loading" :data="list">
        <el-table-column label="用户编号" align="center" key="id" prop="id" />
        <el-table-column
          label="用户名称"
          align="center"
          prop="username"
          :show-overflow-tooltip="true"
          width="200"
        />
        <!-- <el-table-column
          label="用户昵称"
          align="center"
          prop="nickname"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          label="部门"
          align="center"
          key="deptName"
          prop="deptName"
          :show-overflow-tooltip="true"
        /> -->
        <el-table-column label="手机号码" align="center" prop="mobile" width="120" />
        <!-- <el-table-column label="状态" key="status">
          <template #default="scope">
            <el-switch
              v-model="scope.row.status"
              :active-value="0"
              :inactive-value="1"
              @change="handleStatusChange(scope.row)"
              :disabled="!checkPermi(['system:user:update'])"
            />
          </template>
        </el-table-column> -->
        <el-table-column
          label="创建时间"
          align="center"
          prop="createTime"
          :formatter="dateFormatter"
          width="180"
        />
      </el-table>
      <Pagination
        :total="total"
        v-model:page="queryParams.pageNo"
        v-model:limit="queryParams.pageSize"
        @pagination="getList"
      />
    </ContentWrap>
  </div>
</template>

<script lang="ts" setup>
import { dateFormatter } from '@/utils/formatTime'
import { checkPermi } from '@/utils/permission'

import * as UserApi from '@/api/system/user'

defineOptions({ name: 'SystemUser' })


const loading = ref(true) // 列表的加载中
const total = ref(0) // 列表的总页数
const list = ref([]) // 列表的数
const queryParams = reactive({
  pageNo: 1,
  pageSize: 10,
  username: undefined,
  mobile: undefined,
  status: undefined,
  deptId: undefined,
  roleId: '159',
  createTime: []
})

/** 查询列表 */
const getList = async () => {
  loading.value = true
  try {
    const data = await UserApi.getUserPage(queryParams)
    list.value = data.list
    total.value = data.total
  } finally {
    loading.value = false
  }
}

onMounted(() => {
  getList()
})
</script>

<style scoped></style>
